Can someone help me with the mistake in this syntax: Module mod1 = module(item) string AttrName_to_check = "Attribute Name" string temp = "if ( \"" null " \"" mod1.AttrName_to_check ") return_ " " \"failed\"" string temp1 = eval_ (temp)
chidamla - Wed Feb 16 07:06:51 EST 2011 |
Re: Help on eval_ function -E- DXL: <Line:3> incorrectly concatenated tokens -E- DXL: <Line:3> incorrectly concatenated tokens |
Re: Help on eval_ function ChidambaramL - Wed Feb 16 07:34:05 EST 2011
I am pretty sure your code won't work, even if you resolved the syntax errors. eval_ code is afaik executed at the top level, hence the variable 'mod1' will not be existing, as well as 'AttrName_to_check', once the code is executed. Even if the variables existed, if the attribute does not exist in 'mod1', a call to 'mod1.AttrName_to_check' will just throw an error message (instead of being able to check for 'null', as you plan to do).
string sAttName = "AttrName_to_check"
AttrDef ad = find(module item, sAttName)
if (!null ad)
{ // The attribute exists, now check whether it is a module and / or object level attribute
if (ad.module){print "'" sAttName "' is a module level attribute\n"}
if (ad.object){print "'" sAttName "' is an object level attribute\n
} // The attribute exists, now check whether it is a module and / or object level attribute
else {"No attribute '" sAttName "'\n"}
|
Re: Help on eval_ function This works: Module mod1 = current() string AttrName_to_check = "Gads" string temp = "return_ \"OK\";if ( null \"" probeAttr_(mod1, AttrName_to_check) "\") return_ " " \"failed\"" string temp1 = eval_ (temp) print "Results = " temp1 "\n"
|